<%@page import="com.javandad.app.server.db.DatabaseManager"%>
<%@page import="javax.jdo.PersistenceManager"%>
<%@page import="com.javandad.app.server.db.PMFSingleton"%>
<%@page import="com.javandad.app.shared.entity.User"%>
<%@page import="com.javandad.app.server.UserManager"%>


<%!
User view = null;
User user = null;
String codesvrParam = null;
%>
<%
	PersistenceManager pm = PMFSingleton.getPM();
	DatabaseManager dbm = DatabaseManager.getDefaultDatabaseManager();

	user = (User) session.getAttribute("user");
	String viewParam = null;
	String viewParams = null;

	codesvrParam = request.getParameter("gwt.codesvr");
	if (codesvrParam != null && !codesvrParam.equals(""))
		codesvrParam = "gwt.codesvr=" + codesvrParam;

	
	
	viewParam = request.getParameter("view");
	view = dbm.getUser(viewParam, pm);
	if (viewParam != null && view != null && ( user == null || !(view.getUsername().equals(user.getUsername())))) {
			viewParams = codesvrParam + ("&view=" + view.getUsername());

	} else {
		view = user;
		if (view != null) {
			viewParam = (String) session.getAttribute("username");
			viewParams = codesvrParam ;
			
		}
	}
	
    User show = view;

	


%>
